<template>
	<view class="">
		<NavBar title="店铺管理" :isShowLeftBtn="true">
		</NavBar>
	</view>
	<view class="content" :style="{minHeight:contentHeight}">
		<view class="main">
			<scroll-view scroll-y="true" :style="{height: contentHeight + 'rpx'}" :refresher-threshold="100"
				@scrolltolower="scrolltolowerFun" refresher-enabled="true" refresher-default-style="none">
				<view class="main_list">
					<view class="main_item m_b_24" v-for="(item,index) in storeList" :key="index"
						@click="toDetail(item)">
						<view class="flex_both" style="align-items: flex-start;">
							<view class="flex">
								<view class="m_r_24">
									<up-image :show-loading="true" :src="item.shop_images.split(',')[0]" width="76rpx"
										height="76rpx" radius="5"></up-image>
								</view>
								<view class="">
									<view class="">
										<text class="f_30_0_b">
											总店：{{item.shop_name}}
										</text>
									</view>
									<view class="flex" style="align-items: flex-start;">
										<view class="m_r_10">
											<text class="f_24_0" style="color: #575656;">
												评分
											</text>
										</view>
										<view class="m_t_4">
											<up-rate v-model="item.score"
												active-color="linear-gradient(to bottom, #FFFF59, #F9B900);"
												inactive-color="#b2b2b2" gutter="5" size="20" disabled></up-rate>
										</view>
									</view>
								</view>
							</view>
							<view class="">
								<text class="f_24_0" style="color: #747474;">
									进店 >
								</text>
							</view>
						</view>
						<view class="hr m_t_24 m_b_22">

						</view>
						<view class="">
							<view class="flex">
								<view class="m_r_12 m_b_6">
									<up-image :show-loading="true" src="/static/images/index/clock_icon.png"
										width="28rpx" height="28rpx"></up-image>
								</view>
								<view class="">
									<text class="f_24_0" style="color: #737272;">
										{{item.begin_hour}} - {{item.end_hour}}
									</text>
								</view>
								<view class="f_26_0 m_l_12 m_r_12 m_t_6" style="color: #737272;">
									<text>
										|
									</text>
								</view>
								<view class="">
									<text class="f_24_0" style="color: #FE450C;" v-if="item.is_yingye">
										营业中
									</text>
									<text class="f_24_0" style="color: #737272;" v-else>
										已打烊
									</text>
								</view>
							</view>
						</view>
						<view class="flex" style="align-items: flex-start;">
							<view class="m_r_6 m_t_2 m_l_6" style="width: 28rpx; height: 28rpx;flex-shrink: 0;">
								<up-image :show-loading="true" src="/static/images/index/position_icon.png"
									width="18rpx" height="24rpx"></up-image>
							</view>
							<view class="">
								<text class="f_24_0" style="color: #737272;">
									XX市XX区XXX路123号XX市XX区XXX路123号XX市XX区XXX路123号
								</text>

							</view>
						</view>
					</view>
				</view>
			</scroll-view>
			<view class="empty_box" v-if="!loadShow &&storeList.length ==  0">
				<view class="">
					<up-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
					</up-empty>
				</view>
			</view>
			<view class="loading_box" v-if="loadShow">
				{{ loadMessage }}
			</view>
		</view>
	</view>
</template>
<script setup lang="ts">
	import { ref, reactive, getCurrentInstance } from "vue";
	import { onLoad, onShow } from "@dcloudio/uni-app";
	import NavBar from "@/components/navbar.vue"
	const { proxy } = getCurrentInstance()
	const contentHeight = ref('100vh')
	const statusBarHeight = ref(88)
	onLoad(() => {
		uni.getSystemInfo({
			success: function (info) {
				statusBarHeight.value = (info.statusBarHeight + 44) * 2
				contentHeight.value = `calc(100vh - ${statusBarHeight.value + 76}rpx)`
			}
		});
		getChildShop()
	})
	// 商品列表
	const page = ref(1)
	const loadShow = ref(false)
	const loadMessage = ref('加载中')
	const scrolltolowerFun = () => {
		// page.value = ++page.value;
		// loadShow.value = true;
		// setTimeout(() => {
		// }, 1000)
	}
	const storeList = ref([])
	const getChildShop = async () => {
		let res = await proxy.$http('my.getChildShop')
		let data = res.data
		storeList.value = data
	}
	const toDetail = (e) => {
		uni.navigateTo({
			url: `/pages/my/myStoreDetail?id=${e.shop_id}`
		})
	}
</script>
<style lang="scss" scoped>
	.content {
		background: #F7F8FC;
		padding: 20rpx;
		padding-bottom: 64rpx;

		.main_list {
			.main_item {
				padding: 22rpx 26rpx;
				background: #FFFFFF;
				box-shadow: 2rpx 7rpx 5rpx 0rpx rgba(197, 197, 197, 0.29);
				border-radius: 6rpx;
			}
		}

	}

	::v-deep.uicon-star-fill {
		background: linear-gradient(to bottom, #FFFF59, #F9B900);
		/*设置渐变的方向从左到右 颜色从ff0000到ffff00*/
		-webkit-background-clip: text;
		/*将设置的背景颜色限制在文字中*/
		-webkit-text-fill-color: transparent;
		/*给文字设置成透明*/
	}
</style>